package tech.daoxuan.security.core.social.qq.connect;

import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider;
import org.springframework.social.oauth2.OAuth2Template;
import tech.daoxuan.security.core.social.qq.api.QQ;
import tech.daoxuan.security.core.social.qq.api.impl.QQImpl;

/**
 * @ClassName QQServiceProvider
 * @Description TODO
 * @Author 10983
 * @Date 2019/6/23 13:24
 * @Version 1.0
 */
public class QQServiceProvider extends AbstractOAuth2ServiceProvider<QQ> {

    private String appId;

    private static  final String URL_AUTHORIZE="https://graph.qq.com/oauth2.0/authorize";
    private static  final String URL_ACCESSTOKEN="https://graph.qq.com/oauth2.0/token";

    public QQServiceProvider(String appId,String appSecret) {
        super(new OAuth2Template(appId,appSecret, URL_AUTHORIZE,URL_ACCESSTOKEN ));
    }

    @Override
    public QQ getApi(String accessToken) {
        return new QQImpl(accessToken,appId);
    }
}
